package signup.ui;
import signup.domain.Users;
import signup.domain.UserFactory;
public class createUserHandler {
	private String name;
	private String username;
	private String password;
	private String phoneNumber;
	private String emailAddress;
	private UserFactory userFactory;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getPhoneNumber() {
		return phoneNumber;
	}
	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}
	public String getEmailAddress() {
		return emailAddress;
	}
	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}
	
	public String submit(){
		Users user=null;
		try{
			user=userFactory.createUser(this.name, this.emailAddress, this.phoneNumber, this.password);
		}
		catch(Exception E)
		{
			E.printStackTrace();
		}
		if (user==null)
			return "failure";
		else
			return "success";
	}
	public UserFactory getUserFactory() {
		return userFactory;
	}
	public void setUserFactory(UserFactory userFactory) {
		this.userFactory = userFactory;
	}

}
